package com.aigou.controller;

import com.aigou.pojo.Brand;
import com.aigou.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/brand1")
public class FreemarkerController {

    @Autowired
    BrandService brandService;
    @Autowired
    HttpServletRequest reqeust;

    @RequestMapping("/findAll")
    public String findAll(Model model) {
        List<Brand> list = brandService.findAll();
        reqeust.setAttribute("blist", list);
        return "blist";
    }
    
    @RequestMapping("/findOne")
    @ResponseBody
    public Object findOne() {
    	List<Brand> list = brandService.findAll();
    	return list;
    }
}
